package com.shop2cn.iapi.agentproducts.testcase;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.http.client.ClientProtocolException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.shenqisettlement.parameter.bean.AgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.AgentPriceDto;
import com.shop2cn.iapi.agentproducts.parameter.CatalogPropDto;
import com.shop2cn.iapi.agentproducts.parameter.EditProductRebateBean;
import com.shop2cn.iapi.agentproducts.parameter.ImportAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.LoadPicsBean;
import com.shop2cn.iapi.agentproducts.parameter.ModifyAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ModifyCatalogDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsBean;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductListDto;
import com.shop2cn.iapi.agentproducts.parameter.SaveSelectionConditionBean;
import com.shop2cn.iapi.agentproducts.parameter.SubCatalogDto;
import com.shop2cn.iapi.agentproducts.parameter.VideoDto;
import com.shop2cn.iapi.agentproducts.service.LoadPicsCall;
import com.shop2cn.iapi.agentproducts.service.ModifyAgentProductCall;
import com.shop2cn.iapi.agentproducts.service.ModifyAgentProductCallV2;
import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateCollectionGoodsAddressBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateFreightTemplateBean;
import com.ymatou.iapi.godmch.parameter.CreateCodeBean;
import com.ymatou.iapi.godmch.parameter.SetMarkupConfigBean;
import com.ymatou.iapi.godmch.parameter.createDepotBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.parameter.setConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.service.CreateCodeCall;
import com.ymatou.iapi.godmch.service.SetMarkupConfigCall;
import com.ymatou.iapi.notify.parameter.GetMessageListByTimelineNewBean;
import com.ymatou.iapi.notify.parameter.NotifyResModelDto;
import com.ymatou.iapi.notify.parameter.emu.MessageIsNew;
import com.ymatou.iapi.notify.service.GetMessageListByTimelineNewCall;
import com.ymatou.iapi.optrade.parameter.enums.CancelOrderTypeEnum;
import com.ymatou.iapi.optrade.resp.TradingServiceResp;
import com.ymatou.iapi.prodstock.parameter.AgentProductPo;
import com.ymatou.mq.admin.parameter.MessageListBean;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AddAgentProductCallService;
import com.ymttest.business.service.AgentProductCallService;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.GodfreightmgrService;
import com.ymttest.business.service.MqQueryCallService;
import com.ymttest.business.service.PayGateWayCallService;
import com.ymttest.business.service.Shop2cnStockCallService;
import com.ymttest.business.service.TradingForDGSQCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.model.godmch.mch_depot_info;
import com.ymttest.database.model.stockmgr.agentinventoryExample;
import com.ymttest.database.model.stockmgr.agentinventorysku;
import com.ymttest.database.model.stockmgr.agentinventoryskuExample;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.database.sqlwapper.godfreight.freight_templateWapper;
import com.ymttest.database.sqlwapper.godmch.DefGodMchWapper;
import com.ymttest.database.sqlwapper.stockmgr.agentinventoryWapper;
import com.ymttest.database.sqlwapper.stockmgr.agentinventoryskuWapper;
import com.ymttest.utils.AgentUsers;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * 代理商品编辑接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_ModifyAgentProduct {
	private static ModifyAgentProductBean modifyagentproductBean;
	private static ModifyAgentProductCall modifyagentproductCall;
	private YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
	private YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();

	agentinventoryExample inventoryExample = new agentinventoryExample();
	agentinventoryWapper inventory = new agentinventoryWapper();

	agentinventoryskuExample skuExample = new agentinventoryskuExample();
	agentinventoryskuWapper sku = new agentinventoryskuWapper();

	// 渠道商
	private static int sellerId = AgentUsers.rootUserId;
	private static String sellerName = "NickautoTest";
	// 渠道商->代理商1
	private static int agentUserId1 = AgentUsers.agentUserId1;
	private static String agentUserName1 = "NickautoTest";
	// 渠道商->代理商2
	private static int agentUserId2 = AgentUsers.agentUserId2;
	private static String agentUserName2 = "NickautoTest";

	// 渠道商
	private static int rootUserId = AgentUsers.rootUserId;
	private static String rootUserName = "NickautoTest";

	// vip渠道
	private static int vipRootUserId = AgentUsers.vipRootUserId;
	private static String vipRootUserName = "NickautoTest";
	private static int csId = AgentUsers.csId;
	private static String csName = "NickautoTest";
	// vip渠道->代理
	private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
	private static String vipAgentUserName1 = "dgsq408897016";
	private static int csId1 = AgentUsers.csId1;
	// vip渠道->代理->代理
	private static int vipAgentUserId2 = AgentUsers.vipAgentUserId2;
	private static String vipAgentUserName2 = "NickautoTest";

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("代理商品编辑接口");
	}

	@Before
	public void caseUp() {
		modifyagentproductBean = new ModifyAgentProductBean();
		modifyagentproductCall = new ModifyAgentProductCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(modifyagentproductCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	// 新增规格
	public void setCatalogDto(ModifyAgentProductBean modifyagentproductBean) {
		ModifyCatalogDto catalogDto = new ModifyCatalogDto();
		catalogDto.setDirectPrice(900);
		catalogDto.setStock(110);
//		catalogDto.setSku(modifyagentproductBean.getCatalogList().get(0).getSku());
//		catalogDto.setOperateType(0);
		catalogDto.setPropertyValue("新增规格" + TestDataManager.getRandomNum(6));
		catalogDto.setAgentPriceList(modifyagentproductBean.getCatalogList().get(0).getAgentPriceList());
		CatalogPropDto catalogPropDto1 = new CatalogPropDto();
		catalogPropDto1.setName("自动化测试1_" + TestDataManager.getRandomNum(5));
		catalogPropDto1.setPic("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
		catalogPropDto1.setSubType("欧码");
		catalogPropDto1.setValue("171");

		CatalogPropDto catalogPropDto2 = new CatalogPropDto();
		catalogPropDto2.setName("自动化测试2_" + TestDataManager.getRandomNum(5));
		catalogPropDto2.setPic("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
		catalogPropDto2.setSubType("国码");
		catalogPropDto2.setValue("181");
		
		
		List<CatalogPropDto> propertyList = new ArrayList<>();
		propertyList.add(catalogPropDto1);
		propertyList.add(catalogPropDto2);
		catalogDto.setPropertyList(propertyList);
		modifyagentproductBean.getCatalogList().add(catalogDto);
	}

	public void verifyMongoCurMq(String pid) throws ClientProtocolException, IOException, InterruptedException {
		Thread.sleep(5000);
		MessageListBean MessageListBean2 = MqQueryCallService.initAgentMongoCrud(pid);
		List<Map> joa2 = MqQueryCallService.GetMqMessage(MessageListBean2);
		Logger.debug(joa2);
		int redo = 0;
		while (joa2.size() < 2 && redo < 3) {
			Thread.sleep(5000);
			joa2 = MqQueryCallService.GetMqMessage(MessageListBean2);
			redo++;
		}
		
		String actionType = "ModifyAgentProduct";
		String appId = "agentproducts.iapi.ymatou.com";
		Logger.verifyEquals(actionType, joa2.get(0).get("ActionType"), "验证ActionType");
		Logger.verifyEquals(pid, joa2.get(0).get("ProductId"), "验证ProductId");
		Logger.verifyEquals(appId, joa2.get(0).get("AppId"), "验证AppId");
	}

	
	public void verifyMongoCurMqV2(String pid) throws ClientProtocolException, IOException, InterruptedException {
		Thread.sleep(5000);
		MessageListBean MessageListBean2 = MqQueryCallService.initAgentMongoCrud(pid);
		List<Map> joa2 = MqQueryCallService.GetMqMessage(MessageListBean2);
		Logger.debug(joa2);
		String actionType = "SetAgentProductPriceSpot";
		String appId = "agentproducts.iapi.ymatou.com";
		Logger.verifyEquals(actionType, joa2.get(0).get("ActionType"), "验证ActionType");
		Logger.verifyEquals(pid, joa2.get(0).get("ProductId"), "验证ProductId");
		Logger.verifyEquals(appId, joa2.get(0).get("AppId"), "验证AppId");
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_01() {
		Logger.start(true, "渠道商编辑商品名称，编辑成功，发布上架");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String title = "hello";
			modifyagentproductBean.setTitle(title);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0101() {
		Logger.start(true, "渠道商编辑买家端店铺首页中不可见，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setInvisible(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0102() {
		Logger.start(true, "代理商编辑买家端店铺首页中不可见，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setInvisible(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProductNotsku(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_02() {
		Logger.start(true, "代理商编辑商品名称，编辑成功，发布上架");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(1).setAgentPrice(300);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			String title = "hello";
			modifyagentproductBean.setTitle(title);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProductNotsku(modifyagentproductBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ModifyAgentProduct_03() {
		Logger.start(true, "客服编辑商品名称，编辑成功，发布上架");
		try {
			// TODO
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(1).setAgentPrice(300);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setUserId(csId);
			String title = "hello";
			modifyagentproductBean.setTitle(title);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(title, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getsProduct(),
					"验证title");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_04() {
		Logger.start(true, "代理商编辑商品图片，编辑成功，发布上架");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			List<String> picList = new ArrayList<>();
			String pic = "http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l.jpg";
			picList.add(pic);
			modifyagentproductBean.setPics(picList);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(pic, ymtProductsIWapper.selectProductByProductId(productId).get(0).getsPicUrl(),
					"验证pic");
			AgentProductCallService.checkModifyAgentProductNotsku(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ModifyAgentProduct_05() {
		Logger.start(true, "渠道商编辑商品图片，编辑成功，发布上架");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			List<String> picList = new ArrayList<>();
			String pic = "http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l.jpg";
			picList.add(pic);
			modifyagentproductBean.setPics(picList);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {

			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_06() {
		Logger.start(true, "渠道商编辑物流方式，编辑成功，发布上架");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCatalogStatus(100);
			modifyagentproductBean.setCardInfo(1);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(100, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiCatalogStatus(),
					"验证物流方式");
			Logger.verifyEquals(1, ymtProductsIWapper.selectProductByProductId(productId).get(0).getCardInfo(),
					"验证身份信息");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ModifyAgentProduct_07() {
		Logger.start(true, "代理商编辑物流方式，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setCatalogStatus(100);
			modifyagentproductBean.setCardInfo(1);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_08() {
		Logger.start(true, "渠道商编辑库存，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			int stock = 200;
			modifyagentproductBean.getCatalogList().get(0).setStock(stock);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(stock, ymtCatalogsIWapper
					.selectCatalogsByCatalogId(modifyagentproductBean.getCatalogList().get(0).getCatalogId()).getiNum(),
					"验证库存");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0801() {
		Logger.start(true, "渠道商新增规格属性，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			
			CatalogPropDto catalogPropDto1 = new CatalogPropDto();
			catalogPropDto1.setName("自动化测试5_" + TestDataManager.getRandomNum(5));
			catalogPropDto1
					.setPic("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
			catalogPropDto1.setSubType("码");
			catalogPropDto1.setValue("175");

			CatalogPropDto catalogPropDto2 = new CatalogPropDto();
			catalogPropDto2.setName("自动化测试5_" + TestDataManager.getRandomNum(5));
			catalogPropDto2
					.setPic("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
			catalogPropDto2.setSubType("er码");
			catalogPropDto2.setValue("175");

			
			modifyagentproductBean.getCatalogList().get(0).getPropertyList().remove(0);
			modifyagentproductBean.getCatalogList().get(1).getPropertyList().remove(0);
			modifyagentproductBean.getCatalogList().get(0).getPropertyList().add(catalogPropDto1);
			modifyagentproductBean.getCatalogList().get(1).getPropertyList().add(catalogPropDto2);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
//			Thread.holdsLock(2000);
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0802() {
		Logger.start(true, "渠道商删除规格属性，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);

			modifyagentproductBean.getCatalogList().get(0).getPropertyList().remove(0);
			modifyagentproductBean.getCatalogList().get(1).getPropertyList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0803() {
		Logger.start(true, "渠道商编辑多规格商品，两个规格属性size不一致，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);

			modifyagentproductBean.getCatalogList().get(0).getPropertyList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0804() {
		Logger.start(true, "渠道商编辑多规格商品，规格重复，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			List<CatalogPropDto> propertyList = modifyagentproductBean.getCatalogList().get(0).getPropertyList();
			modifyagentproductBean.getCatalogList().get(1).setPropertyList(propertyList);
			modifyagentproductBean.getCatalogList().get(0).getPropertyList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0805() {
		Logger.start(true, "渠道商编辑多规格商品，规格属性为空，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().forEach(p -> {
				p.setPropertyValue(null);
				p.setPropertyList(null);
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0806() {
		Logger.start(true, "渠道商编辑多规格商品，规格value为空，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().forEach(p -> {
				p.getPropertyList().forEach(x -> {
					x.setValue(null);
				});
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_09() {
		Logger.start(true, "渠道商编辑库存小于0，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setStock(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ModifyAgentProduct_10() {
		Logger.start(true, "代理商商编辑库存，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setStock(100);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_11() {
		Logger.start(true, "代理商编辑代理价小于拿到的代理价，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(10);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("下级代理价需高于拿到的代理价", modifyagentproductCall.getString("message"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_12() {
		Logger.start(true, "代理商编辑直销价小于拿到的代理价，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(100);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_13() {
		Logger.start(true, "渠道商编辑图片，图片大于8张，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			List<String> picList = new ArrayList<>();
			for (int i = 0; i < 9; i++) {
				picList.add(
						"http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l.jpg");
			}
			modifyagentproductBean.setPics(picList);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_14() {
		Logger.start(true, "代理商编辑图片，图片大于8张，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			List<String> picList = new ArrayList<>();
			for (int i = 0; i < 9; i++) {
				picList.add(
						"http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l.jpg");
			}
			modifyagentproductBean.setPics(picList);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_15() {
		Logger.start(true, "渠道商编辑图片，图片小于1张，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setPics(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_16() {
		Logger.start(true, "代理商编辑图片，图片小于1张，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setPics(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_17() {
		Logger.start(true, "渠道商编辑商品备注，超过700个字符，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String rmark = "1";
			for (int i = 0; i < 700; i++) {
				rmark = rmark + "1";
			}
			modifyagentproductBean.setRemark(rmark);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_18() {
		Logger.start(true, "渠道商编辑标题，超过500个字符，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String rmark = "1";
			for (int i = 0; i < 500; i++) {
				rmark = rmark + "1";
			}
			modifyagentproductBean.setTitle(rmark);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_19() {
		Logger.start(true, "代理商编辑标题，超过500个字符，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			String rmark = "1";
			for (int i = 0; i < 500; i++) {
				rmark = rmark + "1";
			}
			modifyagentproductBean.setTitle(rmark);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_20() {
		Logger.start(true, "渠道商编辑商品，没有填标题，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setTitle(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("title:商品标题不能为空", modifyagentproductCall.getString("message"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_21() {
		Logger.start(true, "代理商商编辑商品，没有填标题，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setTitle(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("title:商品标题不能为空", modifyagentproductCall.getString("message"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_22() {
		Logger.start(true, "渠道商编辑商品，没有规格信息，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCatalogList(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_23() {
		Logger.start(true, "代理商编辑商品，没有规格信息，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setCatalogList(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_24() {
		Logger.start(true, "渠道商编辑商品，没有选择物流方式，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCatalogStatus(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("快递配送请选择物流方式", modifyagentproductCall.getString("message"), "验证Code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_25() {
		Logger.start(true, "普通渠道关闭商品代理权限，编辑成功，下级代理商品继承直销价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);

			verifyMongoCurMq(productId);

			Thread.sleep(3000);

			// 验证代理商品状态为删除状态 然后同步服务会将action改成-2
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证action");

			// 商品代理价格表为空
			Logger.verifyEquals(false,
					ymtProductsIWapper.selectAgentPriceByProductIdAndUserId(productId, sellerId).size() == 0,
					"验证渠道商商品代理价格表为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_26() {
		Logger.start(true, "vip渠道->vip1->vip2，vip渠道商关闭下级代理权限，编辑成功，下级代理商品继承直销价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			Thread.sleep(3000);
			// 同步服务会将action改成-2
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(agentProductId);
			Logger.verifyEquals(0, agentProductPo.getAction(), "验证action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证action");

			AgentProductPo agentProductPo1 = ymtProductsIWapper.selectAgentProductByProductId(agentProductId1);
			Logger.verifyEquals(0, agentProductPo1.getAction(), "验证action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证action");

			Logger.verifyEquals(false,
					ymtProductsIWapper.selectAgentPriceByProductIdAndUserId(productId, vipRootUserId).size() == 0,
					"验证商品代理价格表为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_27() {
		Logger.start(true, "vip渠道->vip1->vip2，vip1关闭下级代理权限，编辑成功，下级代理商品删除");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProductNotsku(modifyagentproductBean);
			Thread.sleep(3000);

			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(agentProductId);
			Logger.verifyEquals(0, agentProductPo.getAction(), "验证action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证action");

			// 同步服务会将action改成-2
			AgentProductPo agentProductPo1 = ymtProductsIWapper.selectAgentProductByProductId(agentProductId1);
			Logger.verifyEquals(0, agentProductPo1.getAction(), "验证action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证action");

			Logger.verifyEquals(false, ymtProductsIWapper
					.selectAgentPriceByProductIdAndUserId(agentProductId, vipAgentUserId1).size() == 0, "验证商品代理价格表为空");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_28() {
		Logger.start(true, "普通渠道商，新增规格，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			// 新增规格
			setCatalogDto(modifyagentproductBean);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			verifyMongoCurMq(productId);

			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_29() {
		Logger.start(true, "vip渠道商新增规格，编辑成功");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			// 新增规格
			setCatalogDto(modifyagentproductBean);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			verifyMongoCurMq(productId);


		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_30() {
		Logger.start(true, " vip渠道商新增规格，未填写库存，编辑成功");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);

			setCatalogDto(modifyagentproductBean);
			modifyagentproductBean.getCatalogList().get(2).setStock(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_32() {
		Logger.start(true, "普通渠道商新增规格，未填写直销价，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			// 新增规格
			ModifyCatalogDto catalogDto = new ModifyCatalogDto();
			catalogDto.setDirectPrice(0);
			catalogDto.setStock(100);
			catalogDto.setSku(modifyagentproductBean.getCatalogList().get(0).getSku());
			catalogDto.setOperateType(0);
			catalogDto.setPropertyValue("新增规格" + TestDataManager.getRandomNum(6));
			catalogDto.setAgentPriceList(modifyagentproductBean.getCatalogList().get(0).getAgentPriceList());
			modifyagentproductBean.getCatalogList().add(catalogDto);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_33() {
		Logger.start(true, "vip渠道->vip1->vip2 渠道商新增规格，未填写直销价，编辑失败");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			// 新增规格
			ModifyCatalogDto catalogDto = new ModifyCatalogDto();
			catalogDto.setDirectPrice(0);
			catalogDto.setStock(100);
			catalogDto.setSku(modifyagentproductBean.getCatalogList().get(0).getSku());
			catalogDto.setOperateType(0);
			catalogDto.setPropertyValue("新增规格" + TestDataManager.getRandomNum(6));
			catalogDto.setAgentPriceList(modifyagentproductBean.getCatalogList().get(0).getAgentPriceList());
			modifyagentproductBean.getCatalogList().add(catalogDto);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_34() {
		Logger.start(true, "普通渠道商修改多规格商品的一个规格的代理价（修改后≥下级代理的销售价），编辑成功，下级代理商商品价格待完善");
		try {
			// 渠道商
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// 普通代理商
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			// 编辑
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			// 修改规格的代理价
			String catalogId = modifyagentproductBean.getCatalogList().get(0).getCatalogId();
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(500);
			});

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_3401() {
		Logger.start(true, "普通渠道商修改多规格商品所有规格的代理价（修改后≥下级代理的销售价），编辑成功，下级代理商商品价格待完善");
		try {
			// 渠道商
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// 普通代理商
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			// 编辑
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().forEach(p -> {
				p.getAgentPriceList().forEach(c -> {
					c.setAgentPrice(500);
				});
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_35() {
		Logger.start(true, "多规格商品，vip渠道->vip1->vip2,vip渠道商修改一个规格的代理价（修改后≥下级代理的销售价），编辑成功，验证代理商代理的这个商品状态是待完善状态");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			double price = 500.00;
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(price);
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			Thread.sleep(1000);

			List<NotifyResModelDto> notify = getNotify(vipAgentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");

			ymtProductsIWapper.selectAgentPriceById(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
					.forEach(p -> {
						if (p.getAgentTypeId() != 0) {
							Logger.verifyEquals(price, p.getAgentPrice(), "验证渠道商代理价");
						}
					});
			// 同步服务会将action改成-2
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiAction(),
					"验证渠道商商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品action");
			// Logger.verifyEquals(-2,ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),"验证vip2商品已被删除");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getInfoProgress(), "");
			// Logger.verifyEquals(-2,ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getInfoProgress(),"");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getInfoProgress(),
					"");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(), "");
			// Logger.verifyEquals(-2,ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(),"");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_36() {
		Logger.start(true, "多规格商品，vip渠道->vip1->vip2,vip1修改一个规格的代理价（修改后≥下级代理的销售价），编辑成功，验证代理商代理的这个商品状态是待完善状态");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			double price = 500.00;
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(price);
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkModifyAgentProductNotsku(modifyagentproductBean);
			Thread.sleep(2000);

			List<NotifyResModelDto> notify = getNotify(vipAgentUserId2);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean1.getTitle()),"验证发送通知成功");

			ymtProductsIWapper.selectAgentPriceById(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
					.forEach(p -> {
						if (p.getAgentTypeId() != 0) {
							Logger.verifyEquals(price, p.getAgentPrice(), "验证渠道商代理价");
						}
					});

			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiAction(),
					"验证渠道商商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证vip2商品已被删除");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getInfoProgress(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getInfoProgress(),
					"");
			// Logger.verifyEquals(-2,ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getInfoProgress(),"");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(), "");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_37() {
		Logger.start(true, "普通渠道商修改规格代理价（修改后仍＜下级代理的销售价），编辑成功，下级代理状态不变");
		try {
			// 渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			double price = 100.00;
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(price);
			});

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			List<NotifyResModelDto> notify = getNotify(agentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");

			ymtProductsIWapper.selectAgentPriceById(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
					.forEach(p -> {
						if (p.getAgentTypeId() != 0) {
							Logger.verifyEquals(price, p.getAgentPrice(), "验证渠道商代理价");
						}
					});
			// 状态不变
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiAction(),
					"验证渠道商商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品action");
			// 状态不变
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getInfoProgress(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getInfoProgress(),
					"");
			// 状态不变
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(), "");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_38() {
		Logger.start(true, "vip渠道商修改规格代理价（修改后仍＜下级代理的销售价），编辑成功，下级代理状态不变");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			double price = 100.00;
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(price);
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(2000);
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			// 只通知vip1
			List<NotifyResModelDto> notify = getNotify(vipAgentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");

			ymtProductsIWapper.selectAgentPriceById(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
					.forEach(p -> {
						if (p.getAgentTypeId() != 0) {
							Logger.verifyEquals(price, p.getAgentPrice(), "验证渠道商代理价");
						}
					});

			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiAction(),
					"验证渠道商商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证vip2商品已被删除");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getInfoProgress(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getInfoProgress(),
					"");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getInfoProgress(),
					"");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(), "");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_39() {
		Logger.start(true, "vip渠道商->vip1->vip2，vip1修改规格代理价（修改后仍＜下级代理的销售价），编辑成功，下级代理状态不变");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			double price = 200;
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(price);
			});
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(2000);
			AgentProductCallService.checkModifyAgentProductNotsku(modifyagentproductBean);
			ymtProductsIWapper.selectAgentPriceById(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
					.forEach(p -> {
						if (p.getAgentTypeId() != 0) {
							Logger.verifyEquals(price, p.getAgentPrice(), "验证渠道商代理价");
						}
					});
			List<NotifyResModelDto> notify = getNotify(vipAgentUserId2);

			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean1.getTitle()),"验证发送通知成功");

			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiAction(),
					"验证渠道商商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证vip2商品已被删除");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getInfoProgress(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getInfoProgress(),
					"");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getInfoProgress(),
					"");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(), "");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(), "");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_40() {
		Logger.start(true, "多规格商品，普通渠道商删除一个规格，编辑成功，验证下级代理商规格删除");
		try {
			// 渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			List<ModifyCatalogDto> clist =new ArrayList<ModifyCatalogDto>();
			modifyagentproductBean.getCatalogList().forEach(x->{
				clist.add(x);
			});;
			//现在不传就是删除
//			modifyagentproductBean.getCatalogList().get(0).setOperateType(2);
			modifyagentproductBean.getCatalogList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Thread.sleep(2000);
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			// 验证渠道商规格
			Logger.verifyEquals(-1,
					ymtCatalogsIWapper
							.selectCatalogsByCatalogId(clist.get(0).getCatalogId())
							.getiAction(),
					"验证已删除规格action");
			Logger.verifyEquals(0,
					ymtCatalogsIWapper
							.selectCatalogsByCatalogId(clist.get(1).getCatalogId())
							.getiAction(),
					"验证action");
			Thread.sleep(10000);
			Logger.debug("原始catalogsinfo:"+FormatUtil.beanToGSONString(ymtCatalogsIWapper
			.selectCatalogsByCatalogId(clist.get(0).getCatalogId())));
			Logger.debug("继承catalogsinfo:"+FormatUtil.beanToGSONString(ymtCatalogsIWapper.selectCatalogsByParentCatalogId(clist.get(0).getCatalogId())));
			// 验证代理商规格
			Logger.verifyEquals(-1, ymtCatalogsIWapper
					.selectCatalogsByParentCatalogId(clist.get(0).getCatalogId())
					.getiAction(), "验证代理商action");
			Logger.verifyEquals(0, ymtCatalogsIWapper
					.selectCatalogsByParentCatalogId(clist.get(1).getCatalogId())
					.getiAction(), "验证代理商action");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证代理商品action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证代理商品action");

			Logger.verifyEquals(true, ymtProductsIWapper
					.selectAgentPriceById(clist.get(0).getCatalogId()).size() == 0,
					"验证代理价格表删除规格为空");
			Logger.verifyEquals(false, ymtProductsIWapper
					.selectAgentPriceById(clist.get(1).getCatalogId()).size() == 0,
					"验证代理价格表删除规格为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ModifyAgentProduct_41() {
		Logger.start(true, "单规格商品，普通渠道商编辑代理价格为0，下级代理商商品删除");
		try {
			// 渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().remove(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(0);
			modifyagentproductBean.setSetAgentPrice(true);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			List<NotifyResModelDto> notify = getNotify(agentUserId1);
			Logger.verifyEquals(false, notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),
					"验证发送通知成功");

			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			Thread.sleep(2000);

			// 验证代理商
			Logger.verifyEquals(-2, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).get(0).getiAction(),
					"验证action");
			ymtProductsIWapper.selectAgentPriceById(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
					.forEach(p -> {
						Logger.verifyEquals(.00, p.getAgentPrice(), "验证代理价格表");
					});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_42() {
		Logger.start(true, "多规格商品，普通渠道商设置其中的一个规格代理价格清0，下级对应规格继承上级直销价，发通知");
		try {
			// 渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(0);

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(2000);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);

			List<NotifyResModelDto> notify = getNotify(agentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");

			// 验证代理商
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).get(0).getiAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).get(1).getiAction(),
					"验证action");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_43() {
		Logger.start(true, "vip渠道->vip1->vip2，单规格商品，vip渠道商关闭代理，vip渠道商直销价大于下级代理商设置的代理价");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().forEach(p -> {
				p.setDirectPrice(120d);
				p.getAgentPriceList().forEach(x -> {
					x.setAgentPrice(100);
				});
			});
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			importAgentProductBean.getCatalogList().forEach(p -> {
				p.setDirectPrice(110d);
				p.getAgentPriceList().forEach(x -> {
					x.setAgentPrice(105);
				});
			});
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			importAgentProductBean1.getCatalogList().forEach(p -> {
				p.setDirectPrice(115d);
			});
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);
			modifyagentproductBean.getCatalogList().forEach(p -> {
				p.getAgentPriceList().forEach(x -> {
					x.setAgentPrice(0);
				});
			});

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(10000);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			List<NotifyResModelDto> notify = getNotify(vipAgentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");
			Logger.debug("notify:"+FormatUtil.beanToGSONString(notify));
			long changeNum = notify.stream().filter(n -> n.getMessage().contains(importAgentProductBean.getTitle()))
					.filter(n -> n.getMessage().contains("无法正常销售")).count();
			// Logger.verifyEquals(1l,changeNum,"验证发送无法正常销售通知");

			// 验证vip1
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).get(0).getiAction(),
					"验证action");
			// 验证vip2
			Logger.debug(FormatUtil.beanToGSONString("vip2:"+ymtProductsIWapper.selectAgentProductByProductId(agentProductId1)));
			//-1 数据库修改 -2mongo同步
			Logger.verifyEquals(true, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction()<0,
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).get(0).getiAction(),
					"验证action");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_44() {
		Logger.start(true, "vip渠道->vip1->vip2，多规格商品，vip渠道商关闭代理，下级代理继承直销价");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);

			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(2000);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			List<NotifyResModelDto> notify = getNotify(vipAgentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");

			// 验证vip1
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).get(0).getiAction(),
					"验证action");
			// 验证vip2
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).get(0).getiAction(),
					"验证action");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_4301() {
		Logger.start(true, "vip渠道->vip1->vip2，多规格商品，vip渠道商中的一个规格代理价价格清零，下级对应商品继承渠道商直销价，发通知");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);

			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(true);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(0);
			});

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(2000);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			List<NotifyResModelDto> notify = getNotify(vipAgentUserId1);
			long changeNum = notify.stream().filter(n -> n.getMessage().contains(importAgentProductBean.getTitle()))
					.filter(n -> n.getMessage().contains("修改")).count();
			// Logger.verifyEquals(true,changeNum>=1,"验证发送修改价格销售通知");

			// 验证vip1
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).get(0).getiAction(),
					"验证action");
			// 验证vip2
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(),
					"验证action");
			Logger.verifyEquals(0, ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).get(0).getiAction(),
					"验证action");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_45() {
		Logger.start(true, "多规格商品，vip渠道->vip1->vip2，vip渠道商删除一个规格，下级代理该规格删除");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);
			
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String catalogId = modifyagentproductBean.getCatalogList().get(0).getCatalogId();
			List<ModifyCatalogDto> clist =new ArrayList<ModifyCatalogDto>();
			modifyagentproductBean.getCatalogList().forEach(x->{
				clist.add(x);
			});;
			//现在不传就是删除
//			modifyagentproductBean.getCatalogList().get(0).setOperateType(2);
			modifyagentproductBean.getCatalogList().remove(0);

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Thread.sleep(2000);

			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(productId).get(0).getiAction(),
					"验证vip商品表action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品表action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证vip2商品表action");

			Logger.verifyEquals(-1, ymtCatalogsIWapper.selectCatalogsByCatalogId(catalogId).getiAction(),
					"验证vip删除规格的action");
			Logger.verifyEquals(0,
					ymtCatalogsIWapper
							.selectCatalogsByCatalogId(clist.get(1).getCatalogId())
							.getiAction(),
					"验证vip未删除规格的action");

			Logger.verifyEquals(-1, ymtCatalogsIWapper.selectCatalogsByParentCatalogId(catalogId).getiAction(),
					"验证vip1删除规格的action");
			Logger.verifyEquals(0,
					ymtCatalogsIWapper.selectCatalogsByParentCatalogId(
							clist.get(1).getCatalogId()).getiAction(),
					"验证vip1未删除规格的action");

			Logger.verifyEquals(true, ymtProductsIWapper.selectAgentPriceById(catalogId).size() == 0, "删除规格代理价格表没有数据");
			Logger.verifyEquals(false, ymtProductsIWapper
					.selectAgentPriceById(clist.get(1).getCatalogId()).size() == 0,
					"未删除规格代理价格表数据正常");

			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(productId).getAction(),
					"验证渠道商vip代理商品表action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId).getAction(),
					"验证vip1代理商品表action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectAgentProductByProductId(agentProductId1).getAction(),
					"验证VIP2代理商品表action");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_46() {
		Logger.start(true, "多规格商品，vip渠道->vip1->vip2,vip1删除一个规格，vip2对应规格删除");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			String catalogId = modifyagentproductBean.getCatalogList().get(0).getCatalogId();
			List<ModifyCatalogDto> clist =new ArrayList<ModifyCatalogDto>();
			modifyagentproductBean.getCatalogList().forEach(x->{
				clist.add(x);
			});;
			//现在不传就是删除
//			modifyagentproductBean.getCatalogList().get(0).setOperateType(2);
			modifyagentproductBean.getCatalogList().remove(0);

			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Thread.sleep(10000);

			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId).get(0).getiAction(),
					"验证vip1商品表action");
			Logger.verifyEquals(0, ymtProductsIWapper.selectProductByProductId(agentProductId1).get(0).getiAction(),
					"验证vip2商品表action");

			Logger.verifyEquals(-1, ymtCatalogsIWapper.selectCatalogsByCatalogId(catalogId).getiAction(),
					"验证vip1删除规格的action");
			Logger.verifyEquals(0,
					ymtCatalogsIWapper
							.selectCatalogsByCatalogId(clist.get(1).getCatalogId())
							.getiAction(),
					"验证vip1未删除规格的action");

			Logger.verifyEquals(-1, ymtCatalogsIWapper.selectCatalogsByParentCatalogId(catalogId).getiAction(),
					"验证vip2删除规格的action");
			Logger.verifyEquals(0,
					ymtCatalogsIWapper.selectCatalogsByParentCatalogId(
							clist.get(1).getCatalogId()).getiAction(),
					"验证vip2未删除规格的action");

			Logger.verifyEquals(true, ymtProductsIWapper.selectAgentPriceById(catalogId).size() == 0, "删除规格代理价格表没有数据");
			Logger.verifyEquals(false, ymtProductsIWapper
					.selectAgentPriceById(clist.get(1).getCatalogId()).size() == 0,
					"未删除规格代理价格表数据正常");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_47() {
		Logger.start(true, "单规格商品，operateType为2，编辑失败");
		try {
			// 渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().remove(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setOperateType(2);
			modifyagentproductBean.setSaleType(2);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();

			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_48() {
		Logger.start(true, "上架商品编辑保存为下架，下级代理商品状态不变");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProdutId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSaleType(2);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyEquals(2, ymtProductsIWapper.selectAgentProductByProductId(productId).getStatus(), "验证status");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_49() {
		Logger.start(true, "渠道商编辑商品，品牌不存在，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setBrandId(1006);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_50() {
		Logger.start(true, "渠道商编辑商品，类目不存在，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCategoryId(0);
			modifyagentproductBean.setThirdCategoryId(11);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_51() {
		Logger.start(true, "渠道商客服编辑商品，编辑代理价，编辑成功");
		try {
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			
			int seller = 500023286;
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(seller);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(100);
			ModifyAgentProductCallV2 modifyagentproductCall = new ModifyAgentProductCallV2();
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D76799A6A0A7DFE5EABBBFADB332C40F560517F6D23115912D2A9D66752A159D46C5EF288EA2ACD7155EE0F7923987B3F24F5");
			modifyagentproductCall.callService();
			int sellerId = Integer
					.parseInt(new DefGodMchWapper().selectCsInfoByCsId(seller).get(0).get("mchId").toString());
			modifyagentproductBean.setUserId(sellerId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_52() {
		Logger.start(true, "渠道商客服编辑商品，编辑代理价，没有权限,编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			int seller = 500023289;
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(seller);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(100);
			ModifyAgentProductCallV2 modifyagentproductCall = new ModifyAgentProductCallV2();
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D767915F5F242E8D33853E112C14B8904A6AE559730333EF9D3573D244B59588F70E2BE7FDEE32326B219044BC1E17CF19372");
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_53() {
		Logger.start(true, "渠道商客服编辑商品，编辑商品，没有权限,编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			int seller = 500023289;
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(seller);
			modifyagentproductBean.setTitle("111");
			ModifyAgentProductCallV2 modifyagentproductCall = new ModifyAgentProductCallV2();
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D767915F5F242E8D33853E112C14B8904A6AE559730333EF9D3573D244B59588F70E2BE7FDEE32326B219044BC1E17CF19372");
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_57() {
		Logger.start(true, "渠道商客服编辑商品，无编辑代理价的权限");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			int seller = 500023287;
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			double price = modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).getAgentPrice();
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(100);
			modifyagentproductBean.setUserId(seller);
			modifyagentproductCall.callService();
			// 验证代理价没变
			modifyagentproductBean.setUserId(vipRootUserId);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(price);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_59() {
		Logger.start(true, "渠道商编辑商品，运费模板,编辑成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.getCatalogList().forEach(x -> x.setWeight(5.00));

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);

			CreateFreightTemplateBean createFreightTemplateBean1 = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			createFreightTemplateBean1.setPolicyModel(1);
			String templateId1 = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean1);

			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(createmchBean.getMchId());
			modifyagentproductBean.setFreightTemplateId(Integer.parseInt(templateId1));
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_591() {
		Logger.start(true, "渠道商编辑商品，物流方式,编辑成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.getCatalogList().forEach(x -> x.setWeight(5.00));

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);

			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(createmchBean.getMchId());
			modifyagentproductBean.setCatalogStatus(100);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_60() {
		Logger.start(true, "渠道商编辑商品重量,编辑成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			createFreightTemplateBean.setCurrency(addAgentProductBean.getCurrency());
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);

			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(createmchBean.getMchId());
			modifyagentproductBean.getCatalogList().get(0).setWeight(2);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_61() {
		Logger.start(true, "渠道商编辑商品,运费模板按重,重量为空，编辑失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			createFreightTemplateBean.setCurrency(addAgentProductBean.getCurrency());
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);

			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(createmchBean.getMchId());
			modifyagentproductBean.getCatalogList().forEach(p -> p.setWeight(0));
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ModifyAgentProduct_62() {
		Logger.start(true, "代理商编辑商品,运费模板，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().forEach(x -> x.setWeight(5.00));

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(sellerId, 2, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);

			CreateFreightTemplateBean createFreightTemplateBean1 = GodfreightmgrService
					.initCreateFreightTemplate(sellerId, 2, 2);
			String templateId1 = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean1);

			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setUserId(agentUserId1);
			modifyagentproductBean.setFreightTemplateId(Integer.parseInt(templateId1));
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

			freight_templateWapper templateWapper = new freight_templateWapper();
			templateWapper.updateStatusByKey(Integer.parseInt(templateId));
			templateWapper.updateStatusByKey(Integer.parseInt(templateId1));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_63() {
		Logger.start(true, "渠道商编辑商品,币种，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCurrency("CNY");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			Thread.sleep(2000);
			List<NotifyResModelDto> notify = getNotify(agentUserId1);
			// Logger.verifyEquals(true,notify.get(0).getMessage().contains(importAgentProductBean.getTitle()),"验证发送通知成功");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_64() {
		Logger.start(true, "代理商编辑商品,没有填币种，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCurrency(" ");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_65() {
		Logger.start(true, "渠道商编辑商品,币种和运费模板币种不一致，编辑失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCurrency("CNY");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_66() {
		Logger.start(true, "渠道商编辑商品,选择的币种和商户自己币种不一致，编辑失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCurrency("EUR");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_67() {
		Logger.start(true, "代理商编辑商品,币种，编辑失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCurrency("USD");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setCurrency("CNY");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");

			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(agentProductId);
			Logger.verifyEquals(addAgentProductBean.getCurrency(), agentProductPo.getCurrency(), "验证币种没有变化");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_68() {
		Logger.start(true, "渠道商编辑直销价格，日币，价格小数点后有数字，编辑失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			createmchBean.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setCurrency("JPY");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(1.01);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_69() {
		Logger.start(true, "渠道商编辑代理价格，日币，价格小数点后有数字，编辑失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			createmchBean.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createmchBean);

			List<createmchBean> createmchList = GodmchManageCallService
					.InitcreatemchBeanForAgent(createmchBean.getMchId());
			createmchList.forEach(p -> {
				p.setCountry("JPN");
			});
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), true);
			addAgentProductBean.setCurrency("JPY");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(1.02);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_70() {
		Logger.start(true, "渠道商编辑币种，人民币->日币，价格全部变成整数，编辑成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			createmchBean.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createmchBean);

			List<createmchBean> createmchList = GodmchManageCallService
					.InitcreatemchBeanForAgent(createmchBean.getMchId());
			createmchList.forEach(p -> {
				p.setCountry("JPN");
			});
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));
			
			Integer rootId = createmchBean.getMchId();
			Integer agentId = createmchList.get(0).getMchId();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootId,
					vipRootUserName, true);
			addAgentProductBean.getCatalogList().get(0).setDirectPrice(150.05);
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(90.02);
			addAgentProductBean.setCurrency("CNY");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentId,
					agentUserName1, productId, rootId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCurrency("JPY");
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(150);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(90);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_72() {
		Logger.start(true, "韩国渠道商不支持本国货币，编辑币种，韩币，编辑成功");
		try {
			int rootId = 501470983;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootId,
					vipRootUserName, false);
			addAgentProductBean.setCurrency("CNY");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCurrency("KRW");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_73() {
		Logger.start(true, "渠道商编辑商品，修改品牌品类发送总线消息");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, false);
			addAgentProductBean.getCatalogList().remove(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setBrandId(10061);
			modifyagentproductBean.setThirdCategoryId(1004);
			modifyagentproductBean.setCategoryId(1002);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(5000);
			MessageListBean MessageListBean2 = MqQueryCallService.initAgentMongoCrud(productId);
			List<Map> joa2 = MqQueryCallService.GetMqMessage(MessageListBean2);
			long count = joa2.stream().filter(m -> m.get("ActionType").equals("PassiveModifyAllAgentProduct")).count();
			Logger.verifyEquals(count, 1l, "验证发送PassiveModifyAllAgentProduct消息到总线");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_74() {
		Logger.start(true, "渠道商编辑商品名称，编辑成功，发布上架-修改pic成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String title = "hello";
			modifyagentproductBean.setTitle(title);
			String pic = "https://tse3-mm.cn.bing.net/th?id=OIP.MiAa3XWSiH4MKpx3YeYqpQAAAA&w=152&h=202&c=7&o=5&pid=1.7";
			String cid = modifyagentproductBean.getCatalogList().get(0).getCatalogId();
			modifyagentproductBean.getCatalogList().get(0).setPic(pic);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			verifyMongoCurMq(productId);
			List<YmtCatalogsI> ymtCatalogsIList = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			Logger.debug(FormatUtil.beanToGSONString(ymtCatalogsIList));
			String spic = ymtCatalogsIList.stream().filter(c -> c.getsCatalogId().equals(cid)).findFirst().get()
					.getsPicUrl();
			Logger.verifyEquals(spic, pic, "验证pic");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_75() {
		Logger.start(true, "渠道商编辑商品，二级分类三级分类不存在，自动分配到其他分类中,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCategoryId(0);
			modifyagentproductBean.setThirdCategoryId(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			// 分类修改成其他，然后去验证数据库
			modifyagentproductBean.setCategoryId(1369);
			modifyagentproductBean.setThirdCategoryId(1370);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	// 免税店
	private static int userId = 501465826;
	private static String userName = "韩国免税店";

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_76() {
		Logger.start(true, "渠道商编辑商品，有税费改为包税,成功");
		try {
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV3(userId, userName,
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setTariffRate(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_77() {
		Logger.start(true, "渠道商编辑商品，修改限购、免税店价格、免税店币种,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV3(userId, userName,
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setTariffRate(0);
			modifyagentproductBean.setMarketCurrency("USD");
			modifyagentproductBean.getCatalogList().get(0).setLimitNum(20);
			modifyagentproductBean.getCatalogList().get(0).setMarketPrice(10);
			;
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_78() {
		Logger.start(true, "渠道商发布，一级二级为空，正确三级，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCategoryId(66666);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(vipRootUserId,
					vipRootUserId, productId, true);

			// 修改二级分类为正确的然后去对比数据库
			AddAgentProductCallService.GetProductDetails(initGetProductDetails);
			modifyagentproductBean.setCategoryId(1002);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_79() {
		Logger.start(true, "代理商修改商品的sku时，sku会忽略保存");
		try {
			// 渠道商新建商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			int rootsku = Integer.parseInt(addAgentProductBean.getCatalogList().get(0).getSku());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// vip1代理渠道商
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			// modifyagentproductBean.getCatalogList().get(0).setSku("123123123");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			
			// ProductDetailsBean initGetProductDetails =
			// AddAgentProductCallService.initGetProductDetails(vipRootUserId,
			// vipAgentUserId1, agentProductId, true);
			// AddAgentProductCallService.GetProductDetails(initGetProductDetails);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_80() {
		Logger.start(true, "渠道商修改商品，判断生成的二维码是不是新的，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			String QRcode = addAgentProductBean.getPics().get(0);
			System.out.println("小程序吗：" + QRcode);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCategoryId(66666);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(vipRootUserId,
					vipRootUserId, productId, true);
			// System.out.println(modifyagentproductCall.getJsonObject().get("data").getAsJsonObject().get("pic").getAsJsonArray().get(0));
			// //修改二级分类为正确的然后去对比数据库
			AddAgentProductCallService.GetProductDetails(initGetProductDetails);
			// modifyagentproductBean.setCategoryId(1002);
			// AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_81() {
		Logger.start(true, "删除规格，再添加规格");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV3(userId, userName,
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ModifyAgentProductBean modifyagentproductBean1 = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean1.getCatalogList().remove(0);
			ModifyAgentProductBean modifyagentproductBean2 = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);

			
			modifyagentproductCall.setData(modifyagentproductBean1);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			
			modifyagentproductBean2.getCatalogList().get(0).setCatalogId(null);
			
			modifyagentproductCall.setData(modifyagentproductBean2);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			//这个case是手工校验SELECT * FROM ymt_catalogs WHERE Ymt_Catalogs.sProductId='xxx'
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_052() {
		Logger.start(true, "编辑小视频，成功");
		try {

			// 初始化一个带视频的商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			// 提交发布商品
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			VideoDto video = new VideoDto();
			video.setUrl("http://v2.ymatou.com/11223344.mp4");
			video.setLength(12345);
			video.setPic("http://pic1.ymatou.com/11223344.jpg");
			video.setWidth(1234);
			video.setLength(4321);
			video.setSize(123456);
			modifyagentproductBean.setVideo(video);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_053() {
		Logger.start(true, "设置小视频空，失败");
		try {
			// 初始化一个带视频的商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			// 提交发布商品
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getVideo().setUrl("");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_54() {
		Logger.start(true, "删除小视频封面，失败");
		try {
			// 初始化一个带视频的商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			// 提交发布商品
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getVideo().setPic("");
			;
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_55() {
		Logger.start(true, "设置小视频的视频连接不符合和格式，失败");
		try {
			// 初始化一个带视频的商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			// 提交发布商品
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getVideo().setUrl("");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_56() {
		Logger.start(true, "继承上级，编辑商品后，二维码会刷新");
		try {
			
			// 创建一个渠道商，一个代理商，一个客服
			UserCreateBean usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_channl = DGUserCallService.UserCreateCall(usercreateBean1);
			usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_agent = DGUserCallService.UserCreateCall(usercreateBean1);
			// 设置渠道商
			createmchBean createmchbean = GodmchManageCallService.InitcreatemchBeanForChannel(userId_channl);
			GodmchManageCallService.createmchCallForChannel(createmchbean);
			// 渠道商创建一个邀请码，出来一个自动继承的代理商、自动继承渠道商刚才的商品
			CreateCodeBean createbean = GodmchManageCallService.InitcreateCodeBeanForAgent(userId_channl);
			createbean.setAgentModel(2);// 自动继承
			CreateCodeCall CreateCodeCall = GodmchManageCallService.createCodeCall(createbean);
			List<createmchBean> createmchList = GodmchManageCallService.InitcreatemchBeanForAgent(userId_channl,
					userId_agent); //
			createmchList.get(0).setCode(CreateCodeCall.getCode());
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));
			Thread.sleep(5000);

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,
					usercreateBean1.getNickname(), true);
			// 提交发布商品
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			// 获取老的二维码
			LoadPicsBean loadpicsBean = new LoadPicsBean();
			loadpicsBean.setProductId(productId);
			loadpicsBean.setUserId(userId_channl);
			LoadPicsCall loadpicsCall = new LoadPicsCall();
			loadpicsCall.setData(loadpicsBean);
			loadpicsCall.callService();
			Logger.verifyEquals(200, loadpicsCall.getStatusCode(), "判断code");
			String oldQrCodeSeller = loadpicsCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("pics").get(3)
					.getAsString();

			Thread.sleep(2000);
			loadpicsBean.setUserId(userId_agent);

			loadpicsCall.setData(loadpicsBean);
			loadpicsCall.callService();
			Logger.verifyEquals(200, loadpicsCall.getStatusCode(), "判断code");
			String oldQrCodeAgent = loadpicsCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("pics").get(3)
					.getAsString();

			// 修改主图
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getPics().set(0, "http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/666666666.jpg");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

			Thread.sleep(5000);
			// 获取新的二维码
			loadpicsBean.setUserId(userId_channl);
			loadpicsCall.setData(loadpicsBean);
			loadpicsCall.callService();
			Logger.verifyEquals(200, loadpicsCall.getStatusCode(), "判断code");
			String newQrCodeSeller = loadpicsCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("pics").get(3)
					.getAsString();

			loadpicsBean.setUserId(userId_agent);
			loadpicsCall.setData(loadpicsBean);
			loadpicsCall.callService();
			Logger.verifyEquals(200, loadpicsCall.getStatusCode(), "判断code");
			String newQrCodeAgent = loadpicsCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("pics").get(3)
					.getAsString();

			// 代理新的二维码和旧的二维码不一致
			Logger.verifyNotEquals(newQrCodeAgent, oldQrCodeAgent, "新的和旧的二维码不一样--渠道商");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_057() {
		Logger.start(true, "添加商品增加虚拟库存");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 修改主图
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setVirtualStock(30);
			modifyagentproductBean.getCatalogList().get(0).setStock(130);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_58() {
		Logger.start(true, "添加商品增加虚拟库存,虚拟库存小于0，失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 修改主图
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setVirtualStock(-30);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_059() {
		Logger.start(true, "渠道商编辑库存-比之前库存多，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			int stock = 200;
			modifyagentproductBean.getCatalogList().get(0).setStock(stock);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(stock, ymtCatalogsIWapper
					.selectCatalogsByCatalogId(modifyagentproductBean.getCatalogList().get(0).getCatalogId()).getiNum(),
					"验证库存");
			verifyMongoCurMq(productId);
			// 验证出入库单详情
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			
			skuExample.createCriteria().andProductIdEqualTo(productId)
					.andCatalogIdEqualTo(modifyagentproductBean.getCatalogList().get(0).getCatalogId());
			List<agentinventorysku> skus = sku.selectByExample(skuExample);

			Logger.verifyEquals(100, skus.get(0).getNum(), "验证入库单明细1中的数量");
			Logger.verifyEquals(100, skus.get(1).getNum(), "验证入库单明细2中的数量");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_060() {
		Logger.start(true, "渠道商编辑库存-比之前库存少，编辑成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			int stock = 40;
			modifyagentproductBean.getCatalogList().get(0).setStock(stock);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(stock, ymtCatalogsIWapper
					.selectCatalogsByCatalogId(modifyagentproductBean.getCatalogList().get(0).getCatalogId()).getiNum(),
					"验证库存");
			verifyMongoCurMq(productId);
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
			// 出入库单明细
			skuExample.createCriteria().andProductIdEqualTo(productId)
					.andCatalogIdEqualTo(modifyagentproductBean.getCatalogList().get(0).getCatalogId());
			;
			List<agentinventorysku> skus = sku.selectByExample(skuExample);
			Logger.verifyEquals(100, skus.get(0).getNum(), "验证入库单第一条明细中的数量");
			Logger.verifyEquals(-60, skus.get(1).getNum(), "验证入库单第二条明细中的数量");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_061() {
		Logger.start(true, "渠道商编辑库存-编辑为单价超出一万元，价格风控，失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(10001.00);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("400", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyIsContains("单价超过限额", modifyagentproductCall.getString("message"), "验证message");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_062() {
		Logger.start(true, "渠道商编辑市场价，成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(100.00);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setMarketAmount(101.00);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals(101.00,
					ymtCatalogsIWapper
							.selectCatalogsByCatalogId(modifyagentproductBean.getCatalogList().get(0).getCatalogId())
							.getMarketAmount(),
					"验证市场价");
			verifyMongoCurMq(productId);
			
			AgentProductCallService.checkModifyAgentProduct(modifyagentproductBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_063() {
		Logger.start(true, "代理商修改自动加价商品时不涉及价格，不撤标");
		try {
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);
            
            SetMarkupConfigBean bean = GodmchManageCallService.initSetMarketupBean(agentUserId,
					Arrays.asList(rootUserId));
			bean.setMarkupType(1);
			bean.setPercentage(new BigDecimal(10.00));
			bean.setDecimalType(3);
			bean.setOnSaleType(1);
			bean.setRefreshProduct(false);
			SetMarkupConfigCall call = GodmchManageCallService.SetMarketupBeanCall(bean);
            
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			
			// 查到代理商的商品id
			List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == agentUserId)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
			String agentProductId = ap.get(0).getProductId();
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(ap.get(0).getProductId(),
					addAgentProductBean);
			modifyagentproductBean.setUserId(agentUserId);
			modifyagentproductBean.setTitle("1246666");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agentUserId, agentProductId);
			// 商品打标
			Logger.verifyEquals(agentProd.getAutoMarkupStatus(), 1, "依然有自动加价的标");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_064() {
		Logger.start(true, "代理商修改自动加价商品时，修改了价格，撤消标志");
		try {
//			int rootUserId = 501475646;
//			int agentUserId = 501475647;
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);
            
            SetMarkupConfigBean bean = GodmchManageCallService.initSetMarketupBean(agentUserId,
					Arrays.asList(rootUserId));
			bean.setMarkupType(1);
			bean.setPercentage(new BigDecimal(10.00));
			bean.setDecimalType(3);
			bean.setOnSaleType(1);
			bean.setRefreshProduct(false);
			SetMarkupConfigCall call = GodmchManageCallService.SetMarketupBeanCall(bean);
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			
			// 查到代理商的商品id
			List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == agentUserId)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
			String agentProductId = ap.get(0).getProductId();
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(ap.get(0).getProductId(),
					addAgentProductBean);
			modifyagentproductBean.setUserId(agentUserId);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(500);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agentUserId, agentProductId);

			// 商品打标
			Logger.verifyEquals(agentProd.getAutoMarkupStatus(), 0, "没有了自动加价的标");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_065() {
		Logger.start(true, "渠道商修改自动加价商品时，修改了价格，--发送总线--同步下面价格");
		try {
//			int rootUserId = 501475646;
//			int agentUserId = 501475647;
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(8000);
			// 查到代理商的商品id
			List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == agentUserId)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
			String agentProductId = ap.get(0).getProductId();
			
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(500);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(200);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			// 验证总线消息
			MessageListBean MessageListBean = MqQueryCallService.initSyncAutoMarkup(agentProductId, agentUserId);
			List<Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
			if (joa.size() == 0) {
				Thread.sleep(5000);
				joa = MqQueryCallService.GetMqMessage(MessageListBean);
			}
			Logger.verifyEquals(joa.size(), 1, "有更新价格的总线消息");
			joa.forEach(ele -> {
				Logger.debug(ele.toString());
			});

			Thread.sleep(5000);

			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agentUserId, agentProductId);
			ProductDetailsDto rootProd = AddAgentProductCallService.selectProductDetails(rootUserId, productId);

			double agentprice = agentProd.getCatalogList().get(0).getAgentPrice();
			// 代理价*0.2=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice * 1.33)).intValue(),
					new Double(agentProd.getCatalogList().get(0).getDirectPrice()).intValue(), "");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_066() {
		Logger.start(true, "代理商商品销售价和拿货价相同，编辑成功");
		try {
			// 渠道商新建商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			int rootsku = Integer.parseInt(addAgentProductBean.getCatalogList().get(0).getSku());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip1代理渠道商
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId1, agentUserName1, productId, sellerId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(
					addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).getAgentPrice());
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");

			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agentUserId1, agentProductId);
			Logger.verifyEquals(agentProd.getCatalogList().get(0).getDirectPrice(),
					agentProd.getCatalogList().get(0).getAgentPrice(), "销售价和拿货价一样，不挣钱");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_067() {
		Logger.start(true, "渠道商只支持快递时。取消快递配置、提示不能取消");
		try {
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			addAgentProductBean.setCollectionGoods(false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setExpressDelivery(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("请至少选择一种配送方式", modifyagentproductCall.getString("message"), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_068() {
		Logger.start(true, "渠道商只支持自提时。取消自提快递、提示不能取消");
		try {
			//501465799
			Integer rootUserId = 501465799;

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			addAgentProductBean.setExpressDelivery(false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCollectionGoods(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("请至少选择一种配送方式", modifyagentproductCall.getString("message"), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_069() {
		Logger.start(true, "渠道商取消快递时，之前继承的代理商的商品下架");
		try {
			
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);
            GodfreightmgrService.setCollectionGoodsByAdminCall(rootUserId, true);
            //添加一个自提地址
            CreateCollectionGoodsAddressBean createcollectiongoodsaddressBean = GodfreightmgrService.initCreateCollectionGoodsAddressBean(rootUserId);
            int addressId = GodfreightmgrService.createcollectiongoodsaddressCall(createcollectiongoodsaddressBean);
            //开启自提
            GodfreightmgrService.setCollectionGoodsBySellerCall(rootUserId, true);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId, "", productId, rootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(agentUserId,
					agentUserId, agentProductId, true);
			ProductDetailsDto getProductDetails = AddAgentProductCallService.GetProductDetails(initGetProductDetails);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setExpressDelivery(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");

			// 查询总线发送更改加价配置--一条修改配置的回调
			MessageListBean markupconfig = MqQueryCallService.initRemoveAgentProduct(agentProductId);
			List<Map> mjoa = MqQueryCallService.GetMqMessage(markupconfig);
			if (mjoa.size() == 0) {
				Thread.sleep(5000);
				mjoa = MqQueryCallService.GetMqMessage(markupconfig);
			}
			mjoa.forEach(ele -> {
				Logger.debug(ele.toString());
			});
			Logger.verifyEquals(mjoa.size(), 1, "回调了删除代理商品接口");

			Thread.sleep(5000);
			System.out.println(getProductDetails);
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(agentProductId);
			Logger.verifyEquals(agentProductPo.getAction(), -2, "代理商品已经被删除");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_070() {
		Logger.start(true, "渠道商商户只支持快递时。想设置仅自提、提示不能取消");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId, "",
					true);
			addAgentProductBean.setCollectionGoods(true);
			addAgentProductBean.setExpressDelivery(true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setExpressDelivery(false);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("上门自提开关已关闭，商品不支持仅上门自提", modifyagentproductCall.getString("message"), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_071() {
		Logger.start(true, "VIP渠道商修改自动加价商品时，修改了价格，--发送总线--同步下面两个VIP代理商的价格");
		try {
			//创建一个商户和分销小店vip多级代理
		    Integer vipRootUserId = GodmchManageCallService.CreateGodMch();
		    GodmchManageCallService.SetVip(vipRootUserId);
		    Integer vipAgentUserId = GodmchManageCallService.CreateAgent(vipRootUserId);
		    Integer vipAgentUserId1 = GodmchManageCallService.CreateAgent(vipAgentUserId,vipRootUserId);

		    SetMarkupConfigBean bean = GodmchManageCallService.initSetMarketupBean(vipAgentUserId,
					Arrays.asList(vipRootUserId));
			bean.setMarkupType(1);
			bean.setPercentage(new BigDecimal(10.00));
			bean.setDecimalType(3);
			bean.setOnSaleType(1);
			bean.setRefreshProduct(false);
			SetMarkupConfigCall call = GodmchManageCallService.SetMarketupBeanCall(bean);
			
			bean = GodmchManageCallService.initSetMarketupBean(vipAgentUserId1,
					Arrays.asList(vipAgentUserId));
			bean.setMarkupType(1);
			bean.setPercentage(new BigDecimal(10.00));
			bean.setDecimalType(3);
			bean.setOnSaleType(1);
			bean.setRefreshProduct(false);
			call = GodmchManageCallService.SetMarketupBeanCall(bean);
		    
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(8000);
			
			
			// 查到代理商的商品id
			List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == vipAgentUserId)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
			String agentProductId = ap.get(0).getProductId();

			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(500);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(200);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			// 验证总线消息
			MessageListBean MessageListBean = MqQueryCallService.initSyncAutoMarkup(agentProductId, vipAgentUserId);
			List<Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
			if (joa.size() == 0) {
				Thread.sleep(5000);
				joa = MqQueryCallService.GetMqMessage(MessageListBean);
			}
			Logger.verifyEquals(joa.size(), 1, "有更新价格的总线消息 代理1");
			joa.forEach(ele -> {
				Logger.debug(ele.toString());
			});

			Thread.sleep(5000);

			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(vipAgentUserId,
					agentProductId);
			ProductDetailsDto rootProd = AddAgentProductCallService.selectProductDetails(vipRootUserId, productId);

			double agentprice = agentProd.getCatalogList().get(0).getAgentPrice();
			// 代理价*0.2=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice * 1.1)).intValue(),
					new Double(agentProd.getCatalogList().get(0).getDirectPrice()).intValue(), "验证代理1的价格是否正确");

			// 查到代理商的商品id
			List<AgentProductPo> ap1 = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == vipAgentUserId1)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap1));
			String agentProductId1 = ap1.get(0).getProductId();

			// 验证总线消息
			MessageListBean MessageListBean1 = MqQueryCallService.initSyncAutoMarkup(agentProductId1, vipAgentUserId1);
			List<Map> joa1 = MqQueryCallService.GetMqMessage(MessageListBean1);
			if (joa1.size() == 0) {
				Thread.sleep(5000);
				joa1 = MqQueryCallService.GetMqMessage(MessageListBean1);
			}
			Logger.verifyEquals(joa1.size(), 1, "有更新价格的总线消息 代理2");
			joa1.forEach(ele -> {
				Logger.debug(ele.toString());
			});

			Thread.sleep(5000);

			ProductDetailsDto agentProd1 = AddAgentProductCallService.selectProductDetails(vipAgentUserId1,
					agentProductId1);
			double agentprice1 = agentProd1.getCatalogList().get(0).getAgentPrice();
			// 代理价*0.2=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice1 * 1.1)).intValue(),
					new Double(agentProd1.getCatalogList().get(0).getDirectPrice()).intValue(), "验证代理2的价格是否正确");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_072() {
		Logger.start(true, "VIP代理商修改自动加价商品时，修改了价格，--发送总线--同步下面VIP代理商的价格，并且去掉自己的标");
		try {
			int vipRootUserId = 500781768;
			int vipAgentUserId = 500781769;
			int vipAgentUserId1 = 500781770;

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(8000);

			// 查到代理商的商品id
			List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == vipAgentUserId)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
			String agentProductId = ap.get(0).getProductId();

			// 查到二级代理商的商品id
			List<AgentProductPo> ap1 = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == vipAgentUserId1)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap1));
			String agentProductId1 = ap1.get(0).getProductId();

			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(agentProductId,
					addAgentProductBean);
			modifyagentproductBean.setUserId(vipAgentUserId);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(500);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");

			// 验证总线消息
			MessageListBean MessageListBean = MqQueryCallService.initSyncAutoMarkup(agentProductId1, vipAgentUserId1);
			List<Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
			if (joa.size() == 0) {
				Thread.sleep(5000);
				joa = MqQueryCallService.GetMqMessage(MessageListBean);
			}
			Logger.verifyEquals(joa.size(), 1, "有更新价格的总线消息 代理1");
			joa.forEach(ele -> {
				Logger.debug(ele.toString());
			});

			Thread.sleep(5000);

			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(vipAgentUserId,
					agentProductId);
			ProductDetailsDto agentProd1 = AddAgentProductCallService.selectProductDetails(vipAgentUserId1,
					agentProductId1);
			double agentprice1 = agentProd1.getCatalogList().get(0).getAgentPrice();
			// 代理价*0.2=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice1 * 1.1)).intValue(),
					new Double(agentProd1.getCatalogList().get(0).getDirectPrice()).intValue(), "验证代理2的价格是否正确");

			Logger.verifyEquals(0,agentProd.getAutoMarkupStatus(),"代理1标志");
			Logger.verifyEquals(1,agentProd1.getAutoMarkupStatus(),"代理2标志");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_073() {
		Logger.start(true, "渠道商编辑商品，修改仓库,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			List<mch_depot_info> depotList = GodmchManageCallService
					.SelectDepotByMchIdAndSuccess(sellerId);
			addAgentProductBean.setDepotId(depotList.get(0).getDepotId());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setDepotId(depotList.get(1).getDepotId());
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			Logger.verifyEquals(ymtProductsI.getiBondedArea(), depotList.get(1).getDepotId(), "验证仓库");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_074() {
		Logger.start(true, "渠道商编辑商品，关闭二级代理价,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
//			Logger.verifyEquals(ymtProductsI.getiBondedArea(), depotList.get(1).getDepotId(), "验证仓库");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_075() {
		Logger.start(true, "渠道商编辑商品，修改条形码,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setBarcode(barCodes.get(0)+"_1");
			modifyagentproductBean.getCatalogList().get(1).setBarcode(barCodes.get(1)+"_1");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			Logger.verifyEquals(Catalogs.get(0).getBarcode(), barCodes.get(0)+"_1", "验证条码");
			Logger.verifyEquals(Catalogs.get(1).getBarcode(), barCodes.get(1)+"_1", "验证条码");
		} catch (Exception e) {
			Logger.fail(e);
			
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_0751() {
		Logger.start(true, "渠道商编辑商品，修改条形码,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().remove(0);
			modifyagentproductBean.getCatalogList().get(0).setBarcode(barCodes.get(0)+"_1");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			
			Thread.sleep(2000);
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			Logger.verifyEquals(Catalogs.get(1).getBarcode(), barCodes.get(0)+"_1", "验证条码");
			Logger.verifyEquals(Catalogs.size(), 2, "验证size");
			Logger.verifyEquals(Catalogs.get(0).getiAction(), -1, "验证规格一个存在");
			Logger.verifyEquals(Catalogs.get(1).getiAction(), 0, "验证规格删除一个");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_076() {
		Logger.start(true, "渠道商编辑商品，修改条形码,有特殊字符或者有中文，修改失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setBarcode(barCodes.get(0)+"_哈哈");
			modifyagentproductBean.getCatalogList().get(1).setBarcode(barCodes.get(1)+"_￥");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyEquals("商品条码只能包含数字字母呈下划线", modifyagentproductCall.getString("message"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_077() {
		Logger.start(true, "渠道商编辑商品，修改条形码,两个规格条形码一样，提示重复");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setBarcode(barCodes.get(0)+"_1");
			modifyagentproductBean.getCatalogList().get(1).setBarcode(barCodes.get(0)+"_1");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyEquals("商品条码不能重复", modifyagentproductCall.getString("message"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_078() {
		Logger.start(true, "渠道商编辑商品，修改条形码,同店铺不能有一样的规格");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setBarcode("A123_b123_23594185703");
			modifyagentproductBean.getCatalogList().get(1).setBarcode("A123_b123_235941851703");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyIsContains("商品条码已存在：A123_b123_23594185703", modifyagentproductCall.getString("message"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_079() {
		Logger.start(true, "渠道商编辑商品，app端传入null,二维码不做变更");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setBarcode(null);
			modifyagentproductBean.getCatalogList().get(1).setBarcode(null);
			modifyagentproductBean.setSource("miniapp");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			
			   
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			System.out.println(Catalogs);
			Logger.verifyEquals(Catalogs.get(0).getBarcode(), barCodes.get(0), "验证条码1");
			Logger.verifyEquals(Catalogs.get(1).getBarcode(), barCodes.get(1), "验证条码2");
		} catch (Exception e) {
			Logger.fail(e);
			
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_080() {
		Logger.start(true, "渠道商编辑商品，pc端传入null,清除条形码");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().get(0).setBarcode(null);
			modifyagentproductBean.getCatalogList().get(1).setBarcode(null);
			modifyagentproductBean.setSource("pc");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			System.out.println(Catalogs);
			Logger.verifyEquals(Catalogs.get(0).getBarcode(), null, "验证条码1");
			Logger.verifyEquals(Catalogs.get(1).getBarcode(), null, "验证条码2");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_081() {
		Logger.start(true, "渠道商编辑商品，虚拟库存未核销时，删除规格失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					"", true);
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(30);
			addAgentProductBean.getCatalogList().get(0).setStock(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(2000);
			ProductDetailsDto productDetailsDto = AddAgentProductCallService.selectProductDetails(sellerId, productId);
//			long orderId = Shop2cnStockCallService.InitReduceStockForOrder(sellerId,productDetailsDto.getCatalogList().get(0).getCatalogId(), productId, 20);
//			AgentProductBean productBean = TradingForDGSQCallService.createProxychain(sellerId, 0, false);
//			TradingServiceResp placeOrderResp = TradingForDGSQCallService.placeOrder(productBean, sellerId);
			//下单虚拟库存
			AgentProductBean productBean = new AgentProductBean();
			productBean.setProductId(productId);
			productBean.setRootProductId(productId);
			productBean.setCatalogList(Arrays.asList(productDetailsDto.getCatalogList().get(0).getCatalogId()));
			productBean.setGoodsOwnerId(Long.parseLong(sellerId+""));
			productBean.setSellerId(sellerId);
			productBean.setRootCatalogList(Arrays.asList(productDetailsDto.getCatalogList().get(0).getCatalogId()));
			productBean.setSellerLoginId(sellerName);
			TradingServiceResp placeOrderResp = TradingForDGSQCallService
                    .placeOrder1(productBean, sellerId, 2);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("201", modifyagentproductCall.getString("code"), "验证code");
			Logger.verifyIsContains("未核销", modifyagentproductCall.getString("message"), "验证code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_082() {
		Logger.start(true, "渠道商编辑商品，虚拟库存下单--支付--添加库存核销，删除规格成功");
		try {
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"", true);
			addAgentProductBean.setCurrency("CNY");
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(30);
			addAgentProductBean.getCatalogList().get(0).setStock(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(2000);
			ProductDetailsDto productDetailsDto = AddAgentProductCallService.selectProductDetails(rootUserId, productId);
//			long orderId = Shop2cnStockCallService.InitReduceStockForOrder(sellerId,productDetailsDto.getCatalogList().get(0).getCatalogId(), productId, 50);
			
			//下单虚拟库存
			AgentProductBean productBean = new AgentProductBean();
			productBean.setProductId(productId);
			productBean.setRootProductId(productId);
			productBean.setCatalogList(Arrays.asList(productDetailsDto.getCatalogList().get(0).getCatalogId()));
			productBean.setGoodsOwnerId(Long.parseLong(rootUserId+""));
			productBean.setSellerId(rootUserId);
			productBean.setRootCatalogList(Arrays.asList(productDetailsDto.getCatalogList().get(0).getCatalogId()));
			productBean.setSellerLoginId(rootUserId+"");
			
			TradingServiceResp placeOrderResp = TradingForDGSQCallService
                    .placeOrder1(productBean, rootUserId, 2);
			
			Thread.sleep(3000);
//			Shop2cnStockCallService.ReturnStockForOrder(sellerId,productDetailsDto.getCatalogList().get(0).getCatalogId(), productId, placeOrderResp.getOrderList().get(0).getOrderId());
			//取消订单
//			TradingForDGSQCallService.cancelOrder(placeOrderResp.getOrderList().get(0).getOrderId(), CancelOrderTypeEnum.SELLER_CANCEL_ORDER, rootUserId);
			
			//支付订单
			Long payOrder = TradingForDGSQCallService.payOrder(placeOrderResp.getUserId(), placeOrderResp.getTradingId());
		     PayGateWayCallService.DGSQNotifyCall(
                     String.valueOf(payOrder),
                     placeOrderResp.getPayableAmount().toString(),
                     (int)placeOrderResp.getUserId(), BigDecimal.ZERO.toPlainString(), productBean.getCurrency());
		     
		    Thread.sleep(2000);
			Shop2cnStockCallService.stockIn(rootUserId, productId, 100,0);
			
			Thread.sleep(3000);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			Logger.verifyEquals(Catalogs.size(), 2, "验证size");
			Logger.verifyEquals(Catalogs.get(0).getiAction(), -1, "验证规格一个存在");
			Logger.verifyEquals(Catalogs.get(1).getiAction(), 0, "验证规格删除一个");
		} catch (Exception e) {
			Logger.fail(e);
			
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_083() {
		Logger.start(true, "渠道商编辑商品，虚拟库存下单--取消订单核销，删除规格成功");
		try {
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"", true);
			addAgentProductBean.setCurrency("CNY");
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(30);
			addAgentProductBean.getCatalogList().get(0).setStock(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(2000);
			ProductDetailsDto productDetailsDto = AddAgentProductCallService.selectProductDetails(rootUserId, productId);
//			long orderId = Shop2cnStockCallService.InitReduceStockForOrder(sellerId,productDetailsDto.getCatalogList().get(0).getCatalogId(), productId, 50);
			
			//下单虚拟库存
			AgentProductBean productBean = new AgentProductBean();
			productBean.setProductId(productId);
			productBean.setRootProductId(productId);
			productBean.setCatalogList(Arrays.asList(productDetailsDto.getCatalogList().get(0).getCatalogId()));
			productBean.setGoodsOwnerId(Long.parseLong(rootUserId+""));
			productBean.setSellerId(rootUserId);
			productBean.setRootCatalogList(Arrays.asList(productDetailsDto.getCatalogList().get(0).getCatalogId()));
			productBean.setSellerLoginId(rootUserId+"");
			
			TradingServiceResp placeOrderResp = TradingForDGSQCallService
                    .placeOrder1(productBean, rootUserId, 2);
			
			Thread.sleep(3000);
//			Shop2cnStockCallService.ReturnStockForOrder(sellerId,productDetailsDto.getCatalogList().get(0).getCatalogId(), productId, placeOrderResp.getOrderList().get(0).getOrderId());
			//取消订单
			TradingForDGSQCallService.cancelOrder(placeOrderResp.getOrderList().get(0).getOrderId(), CancelOrderTypeEnum.SELLER_CANCEL_ORDER, rootUserId);
			
			Thread.sleep(3000);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.getCatalogList().remove(0);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			Logger.verifyEquals(Catalogs.size(), 2, "验证size");
			Logger.verifyEquals(Catalogs.get(0).getiAction(), -1, "验证规格一个存在");
			Logger.verifyEquals(Catalogs.get(1).getiAction(), 0, "验证规格删除一个");
		} catch (Exception e) {
			Logger.fail(e);
			
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_084() {
		Logger.start(true, "渠道商编辑商品，修改商品属性");
		try {
			Integer sellerId = 501217421;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setProductParam("{'aa':'bb'}");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String productParam="{'啊啊':'哈哈'}";
			modifyagentproductBean.setProductParam(productParam);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(3000);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(sellerId, productId);
			Logger.verifyEquals(productParam,selectProductDetails.getProductParam(),  "验证productParam");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_085() {
		Logger.start(true, "渠道商编辑商品，修改商品属性,app编辑保持兼容");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productParam="{'啊啊':'哈哈'}";
			addAgentProductBean.setProductParam(productParam);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setProductParam("");
			modifyagentproductBean.setSource("miniapp");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(sellerId, productId);
			Logger.verifyEquals(productParam,selectProductDetails.getProductParam(),  "验证productParam");
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_086() {
		Logger.start(true, "设置的返佣不能大于零售价的50%");
		try {
			//创建一个商户和分销小店
			Integer MchId = GodmchManageCallService.CreateGodMch();
			Integer StoreId = GodmchManageCallService.CreateStores(MchId, 20);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(MchId, "", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			EditProductRebateBean initEditProductRebateBean = AddAgentProductCallService.initEditProductRebateBean(productId,StoreId, MchId, 40);
			 AddAgentProductCallService.EditProductRebateBean(initEditProductRebateBean);
			
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			ModifyCatalogDto catalog = modifyagentproductBean.getCatalogList().get(0);
			System.out.println("直销价："+catalog.getDirectPrice());
			System.out.println("代理价："+catalog.getAgentPriceList());
//			System.out.println("直销价："+catalog.getDirectPrice());
//			直销价-代理价>直销价*分佣比例
//			直销价150，代理价140，佣金必须低于10元
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(150);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(b->{b.setAgentPrice(140);});
			
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
//			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(sellerId, productId);
//			Logger.verifyEquals(productParam,selectProductDetails.getProductParam(),  "验证productParam");
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_087() {
		Logger.start(true, "设置的返佣不能大于零售价的50%");
		try {
			//创建一个商户和分销小店
			Integer MchId = GodmchManageCallService.CreateGodMch();
			GodmchManageCallService.SetVip(MchId);
			Integer AgentId = GodmchManageCallService.CreateAgent(MchId);
			Integer StoreId = GodmchManageCallService.CreateStoresByAgent(MchId,AgentId, 20);
			//创建商品，小店会继承
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(MchId, "", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(AgentId,"",productId,MchId,false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);
			
			
			EditProductRebateBean initEditProductRebateBean = AddAgentProductCallService.initEditProductRebateBean(productId,StoreId,AgentId, 40);
			 AddAgentProductCallService.EditProductRebateBean(initEditProductRebateBean);
			
			
			//渠道商-》代理商-》分销小店
			//代理商给分销小店设置40
			//代理商拿货140，卖150。会给分销小店60佣金，自己赔30
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			ModifyCatalogDto catalog = modifyagentproductBean.getCatalogList().get(0);
			System.out.println("直销价："+catalog.getDirectPrice());
			System.out.println("代理价："+catalog.getAgentPriceList());
//			System.out.println("直销价："+catalog.getDirectPrice());
//			直销价-代理价>直销价*分佣比例
//			直销价150，代理价140，佣金必须低于10元
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(150);
			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(b->{b.setAgentPrice(140);});
			
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
//			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(sellerId, productId);
//			Logger.verifyEquals(productParam,selectProductDetails.getProductParam(),  "验证productParam");
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_088() {
		Logger.start(true, "指定下级商品时，编辑商品如果不匹配条件会被移除");
		try {
			//创建一个商户和分销小店
			Integer MchId = GodmchManageCallService.CreateGodMch();
			GodmchManageCallService.SetVip(MchId);
			Integer AgentId = GodmchManageCallService.CreateAgent(MchId);
			Integer StoreId = GodmchManageCallService.CreateStoresByAgent(MchId,AgentId, 20);
			//创建商品，小店会继承
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(MchId, "", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(AgentId,"",productId,MchId,false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);
			
			SaveSelectionConditionBean initSaveSelectionCondition = AddAgentProductCallService.InitSaveSelectionCondition(MchId, AgentId, 1);
			initSaveSelectionCondition.setBrandIdList(Arrays.asList(addAgentProductBean.getBrandId()));
			AddAgentProductCallService.SaveSelectionCondition(initSaveSelectionCondition);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setBrandId(21489);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(10000);
			// 查询代理商的商品id
			List<AgentProductPo> ap1 = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
								.filter(x -> x.getUserId() == AgentId)
								.collect(Collectors.toList());
			Logger.verifyEquals(-2, ap1.get(0).getAction(), "筛选后删除商品");
			
			
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_089() {
		Logger.start(true, "条件加价 自动铺货，修改品牌不符合规则会取消自动加价");
		try {
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
            
            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
            setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
            setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			
			Thread.sleep(8000);
			List<ProductListDto> getProductLists1 = AddAgentProductCallService.GetProductLists(agent_mchId);
			Logger.verifyEquals(1, getProductLists1.size(), "验证上架商品");
			
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(agent_mchId,
					agent_mchId, getProductLists1.get(0).getProductId(), true);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			Logger.verifyEquals(1, selectProductDetails.getAutoMarkupStatus(), "验证自动加价配置");
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCategoryId(1009);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(3000);
			
			selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			Logger.verifyEquals(-1, selectProductDetails.getAutoMarkupStatus(), "验证自动加价配置已经取消");
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_090() {
		Logger.start(true, "自动铺货，修改仓库不符合规则会取消自动加价");
		try {
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            createDepotBean bean1=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByMchId(mchId);
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
            setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
            setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			
			Thread.sleep(8000);
			List<ProductListDto> getProductLists1 = AddAgentProductCallService.GetProductLists(agent_mchId);
			Logger.verifyEquals(1, getProductLists1.size(), "验证上架商品");
			
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(agent_mchId,
					agent_mchId, getProductLists1.get(0).getProductId(), true);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			Logger.verifyEquals(1, selectProductDetails.getAutoMarkupStatus(), "验证自动加价配置");
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setDepotId(selectDepotByDepotTitle.get(1).getDepotId());
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(3000);
			
			selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			Logger.verifyEquals(-1, selectProductDetails.getAutoMarkupStatus(), "验证自动加价配置已经取消");
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_091() {
		Logger.start(true, "编辑商品，修改商品副标题，销售区域，自提点Id，7天无理由退货");
		try {
			Integer sellerId = GodmchManageCallService.CreateGodMch();
			CreateCollectionGoodsAddressBean initCreateCollectionGoodsAddressBean = GodfreightmgrService.initCreateCollectionGoodsAddressBean(sellerId);
			int createcoll = GodfreightmgrService.createcollectiongoodsaddressCall(initCreateCollectionGoodsAddressBean);
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			String subtitle="副标题"+TestDataManager.randomStr(10);
			modifyagentproductBean.setSubTitle(subtitle);
			modifyagentproductBean.setSaleArea(3);
			modifyagentproductBean.setCollectionGoodsAddress(Arrays.asList(createcoll));
			modifyagentproductBean.setNoReasonReturn(true);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证code");
			Thread.sleep(3000);
			
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			AgentProductPo agentProductPo =  new YmtProductsIWapper().selectAgentProductByProductId(productId);
			
			Logger.verifyEquals(subtitle, agentProductPo.getSubTitle(), "验证SubTitle");
			Logger.verifyEquals(3, agentProductPo.getSaleArea(), "验证SaleArea");
			Logger.verifyEquals(createcoll+"", agentProductPo.getCollectionGoodsAddress(), "验证CollectionGoods");
			Logger.verifyEquals(true, ymtProductsI.getbNoReasonReturn(), "验证NoReasonReturn");
			
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_092() {
		Logger.start(true, "代理商修改代理价自动加价商品时不涉及价格以及条件，不撤标");
		try {
			
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId, "", productId, rootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			Thread.sleep(5000);
			
			// 查到代理商的商品id
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setTitle("1246666");
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agentUserId, agentProductId);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_093() {
		Logger.start(true, "代理商修改代理价自动加价商品时涉及条件，撤标");
		try {
			
			Integer rootUserId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(rootUserId, 1);
            Integer agentUserId = GodmchManageCallService.getAgentMchId(rootUserId, agenttype);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(agentUserId, "", productId, rootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			Thread.sleep(5000);
			
			// 查到代理商的商品id
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,
					importAgentProductBean);
			modifyagentproductBean.setBrandId(21487);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agentUserId, agentProductId);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_094() {
		Logger.start(true, "代理商修改代理价自动加价商品时涉及价格，撤标");
		try {
			//创建一个渠道商-》代理-》代理
//			Integer MchId = 501258547;
//			Integer AgentId = 501258548;
//			Integer AgentId1 = 501258549;
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
            SetMarkupConfigBean bean = GodmchManageCallService.initSetMarketupBean(agent_mchId,
					Arrays.asList(mchId));
			bean.setMarkupType(1);
			bean.setPercentage(new BigDecimal(10.00));
			bean.setDecimalType(3);
			bean.setOnSaleType(1);
			bean.setRefreshProduct(true);
			SetMarkupConfigCall call = GodmchManageCallService.SetMarketupBeanCall(bean);

			
			//渠道商创建商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId,
					"", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			Thread.sleep(10000);
			// 查询代理的
            List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId);
           
            ap=ap.stream()
 					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == agent_mchId)
 					.collect(Collectors.toList());
            
            Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
			// 查到代理商的商品id
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(ap.get(0).getProductId(),
					addAgentProductBean);
			
			modifyagentproductBean.setUserId(agent_mchId);
			modifyagentproductBean.getCatalogList().get(0).setDirectPrice(500.0);
			modifyagentproductBean.getCatalogList().get(1).setDirectPrice(500.0);
//			Logger.debug("ccc:"+FormatUtil.beanToGSONString(modifyagentproductBean.getCatalogList().get(0)));
//			double p1 = modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).getAgentPrice()+1;
//			modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(p1);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			
			ProductDetailsDto agentProd = AddAgentProductCallService.selectProductDetails(agent_mchId,
					ap.get(0).getProductId());
			// 商品打标
			Logger.verifyEquals(agentProd.getAutoMarkupStatus(),0, "代理价自动加价的标志取消");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_095() {
		Logger.start(true, "修改旅游商品，物流方式会根据品牌变化");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCategoryId(2661);
			addAgentProductBean.setThirdCategoryId(2662);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(2000);
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			Logger.verifyEquals(8, ymtProductsI.getiCatalogStatus(), "物流方式改为了普通");
			// 查到代理商的商品id
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setCategoryId(1001);
			modifyagentproductBean.setThirdCategoryId(1003);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
			Thread.sleep(1000);
			ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			Logger.verifyEquals(999, ymtProductsI.getiCatalogStatus(), "物流方式改为了普通");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ModifyAgentProduct_096() {
		Logger.start(true, "编辑组合商品");
		try {
			
			AddAgentProductBean Product1 = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			Product1.getCatalogList().remove(0);
			String productId1 = AddAgentProductCallService.AddAgentProduct(Product1);
			
			
			AddAgentProductBean Product2 = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			Product2.getCatalogList().remove(0);
			String productId2 = AddAgentProductCallService.AddAgentProduct(Product2);
			
			AddAgentProductBean addAgentProductBean=AddAgentProductCallService.initAddAgentProduct(sellerId,sellerName, true);
			
			addAgentProductBean.getCatalogList().remove(1);
			SubCatalogDto subCatalogDto = new SubCatalogDto();
			subCatalogDto.setSkuId(Product1.getCatalogList().get(0).getSku());
			subCatalogDto.setBarcode(Product1.getCatalogList().get(0).getBarcode());
			subCatalogDto.setSalePrice(Product1.getCatalogList().get(0).getDirectPrice());
			subCatalogDto.setNum(10);
			
			
			SubCatalogDto subCatalogDto1 = new SubCatalogDto();
			subCatalogDto1.setSkuId(Product2.getCatalogList().get(0).getSku());
			subCatalogDto1.setBarcode(Product2.getCatalogList().get(0).getBarcode());
			subCatalogDto1.setSalePrice(Product2.getCatalogList().get(0).getDirectPrice());
			subCatalogDto1.setNum(10);
			
			addAgentProductBean.setSubCatalogs(Arrays.asList(subCatalogDto,subCatalogDto1));
			
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(2000);
			
			
			// 查到代理商的商品id
			modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			modifyagentproductBean.setSubCatalogs(null);
			modifyagentproductCall.setData(modifyagentproductBean);
			modifyagentproductCall.callService();
			Logger.verifyEquals("200", modifyagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	public static List<NotifyResModelDto> getNotify(int userId) throws IOException {
		GetMessageListByTimelineNewBean getmessagelistbytimelinenewBean = new GetMessageListByTimelineNewBean();
		GetMessageListByTimelineNewCall getmessagelistbytimelinenewCall = new GetMessageListByTimelineNewCall();
		getmessagelistbytimelinenewBean.setFromUserId("19000200");
		getmessagelistbytimelinenewBean.setToUserId(userId);
		getmessagelistbytimelinenewBean.setIsNew(MessageIsNew.No);
		getmessagelistbytimelinenewBean.setLongTimeline(YMTDateUtil.getDate().getTime());
		getmessagelistbytimelinenewBean.setMessageCount(20);
		getmessagelistbytimelinenewBean.setIsNotClearUnReadCount(true);
		getmessagelistbytimelinenewCall.setData(getmessagelistbytimelinenewBean);
		getmessagelistbytimelinenewCall.callService();
		List<NotifyResModelDto> notifyResModelDtos = getmessagelistbytimelinenewCall.getResults();
		return notifyResModelDtos;
	}

}